package com.example.lanqiaodemo1.JavaTest;


import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;

public class Dir {


    public static void main(String[] args) {
        int dirNum=0;//计算目录的个数
        int fileNum=0;//计算文件的个数
        Long getFileSize=0l;
        SimpleDateFormat a = new SimpleDateFormat("yyyy/MM/dd HH:mm");
        Scanner sc = new Scanner(System.in);
        String s =sc.nextLine();
        File file = new File(s);
        if(!file.exists()){
            System.out.println("无此目录");
        }
        else {
            File str[]=file.listFiles();
            for (int i = 0; i < str.length; i++) {
                System.out.print(a.format(new Date(str[i].lastModified()))+"\t");
                if(str[i].isDirectory()){
                    dirNum++;
                    System.out.print("<DIR>\t\t\t");
                }else{
                    fileNum++;
                    getFileSize+=str[i].length();
//                    System.out.print("\t"+str[i].length()+"\t");
                    System.out.printf("     "+str[i].length()+"\t");
                }
                System.out.print(str[i].getName()+"\n");
            }
        }
        System.out.println(fileNum+" 个文件"+"\t"+getFileSize+" 字节"+"\n"+dirNum+" 个目录"+"\t"+file.getFreeSpace()+" 个可用字节");

    }

}

